import { BasePagesResponseData, BaseResponseData } from "@renderer/interface/baseData";
import { SearchSubject, SubjectForm, SubjectItem, SubjectItemLevel } from "@renderer/interface/subject";
import http from "@renderer/utils/request";

/**
 * 获取科目列表
 * @param data 科目搜索表单
 * @returns 科目列表
 */
export const getSubjectPageApi = (data?: SearchSubject) =>
	http.get<BasePagesResponseData<SubjectItem>>('/crm/teach/subject/page', data)
/**
 * 
 * @param id 科目id
 * @returns 科目等级列表
 */
export const getGradeListApi = (data: { subjectId: string }) =>
	http.get<BaseResponseData<SubjectItemLevel[]>>('/crm/teach/grade/all', data)
/**
 * 添加/修改科目
 * @param data 科目表单
 * @returns 
 */
export const postSubjectAOUApi = (data: SubjectForm) =>
	http.post<BaseResponseData<string>>(`/crm/teach/subject/${data.id ? 'update' : 'add'}`, data)
/**
 * 获取科目详情
 * @param id 科目id
 * @returns 科目详情
 */
export const getSubjectGetApi = (id: string) =>
	http.get<BaseResponseData<SubjectForm>>(`/crm/teach/subject/get/${id}`)
/**
 * 删除某一科目
 * @param id 科目id
 * @returns 
 */
export const getSubjectDelApi = (id: string) =>
	http.get<BaseResponseData<string>>(`/crm/teach/subject/delete/${id}`)


export const getSubjectExportApi = (data: {
	subjectName?: string
	enabled?: string
}) =>
	http.get<BaseResponseData<string>>(`/crm/teach/subject/export`, data)